package com.dy.dao;

import com.dy.bean.Sugar;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SugarDao {
    @Select("SELECT b2.`name`,sum(final_total_amount)'value' FROM order_info o \n" +
            "LEFT JOIN order_detail d on o.id = d.order_id\n" +
            "LEFT JOIN sku_info s on d.sku_id =s.id\n" +
            "LEFT JOIN base_category3 b3 on s.category3_id =b3.id\n" +
            "LEFT JOIN base_category2 b2 on b3.category2_id = b2.id\n" +
            "GROUP BY b2.`name`")
    List<Sugar> showTwo();
    @Select("SELECT b.name,sum(final_total_amount)'value' FROM order_info o \n" +
            "LEFT JOIN order_detail d on o.id = d.order_id\n" +
            "LEFT JOIN sku_info s on d.sku_id =s.id\n" +
            "LEFT JOIN base_trademark b on s.tm_id =b.id \n" +
            "GROUP BY b.name")
    List<Sugar> showPp();
    @Select("SELECT b.name,sum(final_total_amount)'value' FROM order_info o \n" +
            "LEFT JOIN base_province b on o.province_id = b.id\n" +
            "GROUP BY b.name")
    List<Sugar> showMap();
    @Select("call sp5")
    Double showSum();
    @Select("SELECT sp.spu_name 'name',sum(final_total_amount)'value' FROM order_info o \n" +
            "LEFT JOIN order_detail d on o.id = d.order_id\n" +
            "LEFT JOIN sku_info s on d.sku_id =s.id\n" +
            "left JOIN spu_info sp on s.spu_id = sp.id\n" +
            "GROUP BY sp.spu_name")
    List<Sugar> showSpu();
}
